package com.gitee.xhs.customFunction;

import com.gitee.xhs.sampleRecod.transactionRecord.Transaction;
import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.util.Collector;

/**
 * @author BigHead
 * @date 2022/7/19 10:44
 * @description OperatorLearnFlatMap
 */
public class OperatorFlatMap implements FlatMapFunction<Transaction, Transaction> {

    @Override
    public void flatMap(Transaction value, Collector<Transaction> out) throws Exception {
        for (int dataIdxNum = 0; dataIdxNum < value.getAccountId(); dataIdxNum++) {
            if (0 != dataIdxNum) {
                value.setAmount(0d);
            }
            out.collect(value);
        }
    }

}
